package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AgriculturalMapper;
import com.ruoyi.system.domain.Agricultural;
import com.ruoyi.system.service.IAgriculturalService;

/**
 * 农产品信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-09-21
 */
@Service
public class AgriculturalServiceImpl implements IAgriculturalService 
{
    @Autowired
    private AgriculturalMapper agriculturalMapper;

    /**
     * 查询农产品信息
     * 
     * @param id 农产品信息主键
     * @return 农产品信息
     */
    @Override
    public Agricultural selectAgriculturalById(Long id)
    {
        return agriculturalMapper.selectAgriculturalById(id);
    }

    /**
     * 查询农产品信息列表
     * 
     * @param agricultural 农产品信息
     * @return 农产品信息
     */
    @Override
    public List<Agricultural> selectAgriculturalList(Agricultural agricultural)
    {
        return agriculturalMapper.selectAgriculturalList(agricultural);
    }

    /**
     * 新增农产品信息
     * 
     * @param agricultural 农产品信息
     * @return 结果
     */
    @Override
    public int insertAgricultural(Agricultural agricultural)
    {
        agricultural.setCreateTime(DateUtils.getNowDate());
        return agriculturalMapper.insertAgricultural(agricultural);
    }

    /**
     * 修改农产品信息
     * 
     * @param agricultural 农产品信息
     * @return 结果
     */
    @Override
    public int updateAgricultural(Agricultural agricultural)
    {
        agricultural.setUpdateTime(DateUtils.getNowDate());
        return agriculturalMapper.updateAgricultural(agricultural);
    }

    /**
     * 批量删除农产品信息
     * 
     * @param ids 需要删除的农产品信息主键
     * @return 结果
     */
    @Override
    public int deleteAgriculturalByIds(Long[] ids)
    {
        return agriculturalMapper.deleteAgriculturalByIds(ids);
    }

    /**
     * 删除农产品信息信息
     * 
     * @param id 农产品信息主键
     * @return 结果
     */
    @Override
    public int deleteAgriculturalById(Long id)
    {
        return agriculturalMapper.deleteAgriculturalById(id);
    }
}
